import selenium.common.exceptions
from selenium import webdriver

# TODO 导入显示等待
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# 显示等待，针对的是某一个标签的状态
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')

#等待True,超时没有返回True就会抛出异常
#result1 = WebDriverWait(driver,10).until(EC.title_is('百度一下，你就知道'),message='标题不一致')
# selenium.common.exceptions.TimeoutException:Message:标题不一致，超时没有判定成功抛出异常

# 等待False, 超时没有返回False,就抛出异常
result2 = WebDriverWait(driver, 10).until_not(EC.title_is('百度一下，你就知道'), message='标题不一致')

print(result2)